package com.vf.admin.common;

import org.springframework.boot.web.server.*;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * 自定义未找到的界面
 */
@Component
public class ErrorPageConfig implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage[] errorPages=new ErrorPage[3];
        errorPages[0]=new ErrorPage(HttpStatus.NOT_FOUND,"/404.html");
        errorPages[1]=new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/500.html");
        errorPages[2]=new ErrorPage(HttpStatus.BAD_REQUEST,"/400.html");

        registry.addErrorPages(errorPages);
    }
}
